import React from 'react'
import { render } from 'react-dom'
import './index.css';
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import todoApp from './reducers'
import App from './components/App'
import registerServiceWorker from './registerServiceWorker'

let store = createStore(todoApp)
store.dispatch({
    type: 'ADD_TODO',
    text: 'Use Redux',
    id: 1
  })
console.log(store)
console.log(store.getState())
// Provider组件 原应用组件上包裹一层，使原来整个应用成为Provider的子组件
render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.getElementById('root')
)

registerServiceWorker();